import java.net.*;
import java.io.*;
public class TCPClient{
    public static void main(String[] args){
        Socket s = null;
        String ip = "127.0.0.1";
        String m = "";
        long sum=0;
        try{
            for(int i=51420;i<1000000000;i+=50){
                byte[] mm = new byte[i];
                //m = new String(mm);
                int serverPort = 7896;
                s = new Socket(ip,serverPort);
                DataInputStream in = new DataInputStream(s.getInputStream());
                DataOutputStream out = new DataOutputStream(s.getOutputStream());
                out.write(mm,0,i);
                String data = in.readUTF();
                System.out.println("data : " + data + "  ,   " + i);
            }

        }catch(UnknownHostException e){
            System.out.println("host error" + e.getMessage());
        }catch(EOFException e){
            System.out.println("EOF error" + e.getMessage());
        }catch(IOException e){
            System.out.println("IO error" + e.getMessage());
        }finally{
            if(s!= null)
                try{
                    s.close();
                }catch(IOException e){}
        }
    }
}
